import java.util.List;
import java.util.Stack;

public class num155 {
    private Stack<Integer>  s1 = new Stack<>();
    private Stack<Integer>  s2 = new Stack<>();
    public void push(int val) {
        s1.push(val);
        if(s2.isEmpty()){
            s2.push(val);
        }else{
            int ret = s2.peek();
            s2.push(Math.min(val,ret));
        }
    }

    public void pop() {
        s1.pop();
        s2.pop();
    }

    public int top() {
        return s1.peek();
    }

    public int getMin() {
        return s2.peek();
    }
}
